doexport = function () {
    let elemets = document.getElementsByName("record");
    let count = 0;
    let arr = [];
    //获取表格中选中的数据
    for (let i = 0; i < elemets.length; i++) {
        if (elemets[i].checked) {
            arr.push(elemets[i].value);
            count++;
        } else {
            count = 0;
        }
    }
    $.ajax({
        url: "/export/",
        type: "get",
        data: {"arr": arr},
        traditional: true,
        success: function (data) {
            let _data = JSON.parse(data);
            console.log(_data);
            hander_data_2_excel(_data);
        }
    })

};



hander_data_2_excel = function (data) {
    // var FileSaver = require('file-server');
    if (data === null) {
        return 0;
    }
    let cpu;
    let cpu_key_name, privateDirty, pssmem;
    for (let key in data.CPU) {
        if (key.search("应用进程-main") !== -1) {
            cpu_key_name = key;
        }
    }
    for (let key in data.Memory) {
        if (key.search("PrivateDirty内存-main") !== -1) {
            privateDirty = key;
        }
        if (key.search("PSS内存-main") !== -1) {
            pssmem = key;
        }
    }
    let cpu_cells_name = {
        a: '时间',
        b: 'CPU占用'
    };
    let cpu_global_data = data.CPU["全局占用"];
    let cpu_process_data = data.CPU[cpu_key_name];
    let pssmem_data = data.Memory[pssmem];
    let privateDirty_data = data.Memory[privateDirty];
    let cpu_global = XLSX.utils.json_to_sheet(cpu_global_data,cpu_cells_name);//创建worksheet对象
    let cpu_process = XLSX.utils.json_to_sheet(cpu_process_data);//创建worksheet对象
    let mem = XLSX.utils.json_to_sheet(pssmem_data);//创建worksheet对象
    let privateDirtymem = XLSX.utils.json_to_sheet(privateDirty_data);//创建worksheet对象
    let wb = XLSX.utils.book_new();//创建workbook对象
    // console.log(cpu_global);
    XLSX.utils.book_append_sheet(wb, cpu_global, 'CPU全局占用');
    XLSX.utils.book_append_sheet(wb, cpu_process, 'CPU进程占用');
    XLSX.utils.book_append_sheet(wb, mem, '内存占用');
    XLSX.utils.book_append_sheet(wb, privateDirtymem, 'privateDirty内存占用');

    let wb_out = XLSX.write(wb, {bookType: 'xlsx', type: 'array'});
    let _blob = new Blob([wb_out], {type: 'application/octet-stream'});
    // saveAs(_blob, '性能测试报告.xlsx');

};